/**
 * Created by Jason_PC on 2017/6/28.
 */
var mongoose = require('mongoose');
mongoose.connect('mongodb://127.0.0.1:27017/NodeJS');

var School = mongoose.model('School', {
    school_id: String,
    school_name: String,
    address: String,
    province: String
});


var schoolModel = new School({
    school_id: 1,
    school_name: '福泉中学',
    address: '贵州省福泉市',
    province: '贵州'
});

/*
schoolModel.save(function (err) {
    if (!err) {
        console.log('success');
    }else{
        console.log('fail');
    }
})
*/
School.find(function (err, schools) {
    console.log(schools);
})

/*
 // middleware
 school.pre('save', function (next) {
 notify(this.get('email'));
 next();
 });*/
